package com.robot.controller;

import com.robot.common.exception.BusinessException;
import com.robot.common.result.Response;
import com.robot.dao.dto.CategoryDTO;
import com.robot.dao.vo.CategoryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/test")
@Slf4j
@Api(tags = "测试接口")
@CrossOrigin
public class ZxxTestController {

    @PostMapping("/create")
    @ApiOperation("创建新类目")
    public Response<CategoryVO> createCategory(@RequestBody CategoryDTO categoryDTO)throws Exception{
        if (true){
//            throw new Exception("测测测");
            throw new BusinessException("测测222测");
        }
        CategoryVO categoryVO = new CategoryVO();
        categoryVO.setCategoryId("testtt");
        return Response.success(categoryVO);
    }

}
